

.LC0:
	.long	0x0
	.long	0x40220000 /* 9 */

.LC1:
	.long 0xe147ae14
	.long 0x3fe6147a /* 0.69 */

.LC2:
	.long 0x851eb851
	.long 0x3fc851eb /* 0.19 */

.LC3:
	.long 0x0	
	.long 0x40000000 /* 2 */

.LC4:
	.long 0x0 
	.long 0x40240000 /* 10 */

.LC5:
	.long 0x54442d18	
	.long 0x400921fb /* PI 3.1415926535897931 */

.LC6:
	.long 0x33333333	
	.long 0x3fd33333 /* 0.3 */

.LC7:
	.long 0x99999999	
	.long 0x3fd99999 /* 0.4 */

.LC8:
	.long 0x33333333	
	.long 0x3fe33333 /* 0.6 */

.LC9:
	.string "expose-event"

.LC10:
	.string "destroy"

.globl main	

on_expose_event:
	pushq %rbp
	movq %rsp,%rbp
	subq $0x1000,%rsp

	movq %rdi,-0x1000(%rbp) /* widget */
	movq %rsi,-0xff8(%rbp) /* event */
	movq %rdx,-0xff0(%rbp) /* data */

	movq $0,-0xfe8(%rbp) /* cr */
	movl $0,-0xfe0(%rbp) /* width */
	movl $0,-0xfdc(%rbp) /* height */
//	movq %fs:40,%rax
//	movq %rax,-0xfd0(%rbp) /* */


	movq -0x1000(%rbp),%rdi /* widget */
	movq 80(%rdi),%rdi /* widget->window */
	movl $0,%eax 
	call gdk_cairo_create 
	movq %rax,-0xfe8(%rbp) /* cr */

	movl $0,%eax
	call gtk_window_get_type 
	movq %rax,%rsi
	movq -0x1000(%rbp),%rdi /* widget */
	call g_type_check_instance_cast 
	leaq -0xfdc(%rbp),%rdx /* height */
	leaq -0xfe0(%rbp),%rsi /* width */
	movq %rax,%rdi
	movl $0,%eax 
	call gtk_window_get_size 

	movsd .LC0(%rip),%xmm0 /* 9 */
	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax 
	call cairo_set_line_width 

	pxor %xmm2,%xmm2
	movsd .LC2(%rip),%xmm1 /* 0.19 */
	movsd .LC1(%rip),%xmm0 /* 0.69 */
	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax 
	call cairo_set_source_rgb 	

	movsd .LC5(%rip),%xmm0 /* PI */
	mulsd .LC3(%rip),%xmm0
	movsd %xmm0,%xmm4 
	pxor %xmm3,%xmm3 /* 0 */
	
	cvtsi2sd -0xfe0(%rbp),%xmm0 /* width */
	cvtsi2sd -0xfdc(%rbp),%xmm1 /* height */
	comisd %xmm0,%xmm1 
	jbe .Lon_expose_event_400
	cvtsi2sd -0xfe0(%rbp),%xmm0 /* width */
	jmp .Lon_expose_event_390

.Lon_expose_event_400:
	cvtsi2sd -0xfdc(%rbp),%xmm0 /* height */

.Lon_expose_event_390:
	movsd .LC3(%rip),%xmm1 /* %xmm1 */
	divsd %xmm1,%xmm0
	subsd .LC4(%rip),%xmm0  /* 10 */
	movsd %xmm0,%xmm2 

	cvtsi2sd -0xfdc(%rbp),%xmm1 /* height */
	movsd .LC3(%rip),%xmm0 /* 2 */
	divsd %xmm0,%xmm1 /* height/2 */

	cvtsi2sd -0xfe0(%rbp),%xmm0 /* width */
	movsd .LC3(%rip),%xmm5 /* 2 */
	divsd %xmm5,%xmm0 /* width/2 */

	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax 
	call cairo_arc 

	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax
	call cairo_stroke_preserve 

	movsd .LC8(%rip),%xmm2 /* 0.6 */
	movsd .LC7(%rip),%xmm1 /* 0.4 */
	movsd .LC6(%rip),%xmm0 /* 0.3 */
	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax 
	call cairo_set_source_rgb 

	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax 
	call cairo_fill 

	movq -0xfe8(%rbp),%rdi /* cr */
	movl $0,%eax
	call cairo_destroy 

	movl $0,%eax
//	movq -0xfd0(%rbp),%rcx
//	xorq %fs:40,%rcx
//	je .Lon_expose_event_0
//
//	movl $0,%eax
//	call __stack_chk_fail

.Lon_expose_event_0:
	leave
	ret


main:
	pushq %rbp
	movq %rsp,%rbp
	subq $0x1000,%rsp

	movl %edi,-0x1000(%rbp) /* argc */
	movq %rsi,-0xff8(%rbp) /* argv */

	movq $0,-0xff0(%rbp) /* window*/
//	movq %fs:40,%rax
//	movq %rax,-0xfe0(%rbp) /**/

	leaq -0xff8(%rbp),%rsi /* argv */
	leaq -0x1000(%rbp),%rdi /* argc */
	movl $0,%eax
	call gtk_init

	movl $0,%edi
	movl $0,%eax
	call gtk_window_new 
	movq %rax,-0xff0(%rbp) /* window */

	movl $80,%esi
	movq -0xff0(%rbp),%rdi /* window */
	call g_type_check_instance_cast 
	
	movl $0,%r9d
	movl $0,%r8d 
	movl $0,%ecx 
	leaq on_expose_event(%rip),%rdx 
	leaq .LC9(%rip),%rsi
	movq %rax,%rdi
	movl $0,%eax 
	call g_signal_connect_data 


	movl $80,%esi
	movq -0xff0(%rbp),%rdi /* window */
	call g_type_check_instance_cast 
	
	movl $0,%r9d
	movl $0,%r8d 
	movl $0,%ecx 
	movq gtk_main_quit@GOTPCREL(%rip),%rdx 
	leaq .LC10(%rip),%rsi
	movq %rax,%rdi
	movl $0,%eax 
	call g_signal_connect_data 

	movl $0,%eax
	call gtk_window_get_type 
	movq %rax,%rsi 
	movq -0xff0(%rbp),%rdi /* window */
	movl $0,%eax 
	call g_type_check_instance_cast 
	movl $1,%esi
	movq %rax,%rdi
	movl $0,%eax
	call gtk_window_set_position

	movl $0,%eax
	call gtk_window_get_type 
	movq %rax,%rsi
	movq -0xff0(%rbp),%rdi /* window */
	movl $0,%eax
	call g_type_check_instance_cast 
	movl $150,%edx 
	movl $200,%esi 
	movq %rax,%rdi
	movl $0,%eax 
	call gtk_window_set_default_size 

	movl $1,%esi
	movq -0xff0(%rbp),%rdi  /* window */
	movl $0,%eax 
	call gtk_widget_set_app_paintable 

	movq -0xff0(%rbp),%rdi  /* window */
	movl $0,%eax
	call gtk_widget_show_all 

	movl $0,%eax
	call gtk_main

	movl $0,%eax
//	movq -0xfe0(%rbp),%rcx /* check */
//	xorq %fs:40,%rcx
//	je .Lmain_0
//
//	movl $0,%eax
//	call __stack_chk_fail 

.Lmain_0:
	leave
	ret
